package com.own.business.push.persistence.mysql.entity.dto;

import com.own.business.push.persistence.mysql.entity.bo.PushRegistrationBo;
import com.own.component.common.base.entity.BaseDto;
import com.own.constant.ConstantBeanSuffix;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.io.Serializable;

/**
 * PushRegistrationDto
 *
 * @author chenxueli
 * @date 2023-11-16 14:14:41
 */
@Schema(title = "推送注册" + ConstantBeanSuffix.DTO)
@Getter
@Setter
@ToString
@Accessors(chain = true)
@AllArgsConstructor
@NoArgsConstructor
public class PushRegistrationDto extends BaseDto<PushRegistrationBo> implements Serializable {

    @Schema(title = "用户id")
    private Long userId;

    @Schema(title = "注册id")
    private String regId;

    @Schema(title = "模块")
    private String module;

    /**
     * 转业务层对象
     *
     * @param entity 原业务层对象
     * @return 业务层对象
     */
    @Override
    public PushRegistrationBo toBo(PushRegistrationBo entity) {
        if (entity == null) {
            entity = new PushRegistrationBo();
        }
        entity.setUserId(this.userId);
        entity.setRegId(this.regId);
        entity.setModule(this.module);
        return super.toBo(entity);
    }

}

